package com.javaprint.order.controller;

import com.javaprint.order.service.PrintOrderService;
import com.javaprint.order.vo.HttpResult;
import com.javaprint.order.vo.OrderPrint;
import com.javaprint.order.vo.PrintVo;
import me.javy.helper.Helper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController
@RequestMapping("/application/order/")
public class PrintController {

    @Autowired
    private PrintOrderService printService;

    private static final Logger logger = LoggerFactory.getLogger(PrintController.class);

    /**
     *检查打印服务状态
     * @return com.cargo.order.vo.HttpResult
     * @since 2020/3/26 15:43
     **/
    @PostMapping("confirmConnect.do")
    public HttpResult queryLogin(){
        return printService.checkState();
    }

    /**
     *打印运单
     * @param vo 订单接收类
     * @author LiQiuLin
     * @since 2020/3/19
     */
    @PostMapping("printAddOrder.do")
    public HttpResult printOrder(@RequestBody PrintVo vo){
        return printService.printStuff(vo);
    }


    @PostMapping("printOrderDetail.do")
    public HttpResult printOrderDetail(@RequestBody List<OrderPrint> rows ){
        return printService.printOrderDetail(rows);
    }
}
